package com.ali.controller;

import com.ali.common.Response;
import com.ali.dto.UserInfo;
import com.ali.service.UserService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;

    /**
     * 查询单个用户
     */
    @GetMapping(value = "/id")
    public Response<UserInfo> getById(@RequestParam Map<String, Object> param) {
        log.info("getById：" + param);
        UserInfo orderInfo = userService.getById(param);
        return Response.success(orderInfo);
    }

    /**
     * 修改用户
     */
    @PostMapping(value = "/update")
    public Response<String> update(@RequestBody Map<String, Object> param) {
        log.info("update：" + param);
        userService.update(param);
        return Response.success("成功修改记录");
    }
}